import { Module } from '@nestjs/common';
import { TypeOrmModule } from '@nestjs/typeorm';
import { DeviceModule } from './device/device.module';
import { MessageModule } from './message/message.module';
import { TcpModule } from './tcp/tcp.module';
import { CacheModule } from './cache/cache.module';
import { createClient } from 'redis';

@Module({
  imports: [
    TypeOrmModule.forRoot({
      type: 'mysql',
      host: '139.129.23.36',
      port: 3306,
      username: 'root',
      password: '@Fish1234HASGnnnx!@',
      database: 'monitor2',
      entities: [__dirname + '/**/*.entity{.ts,.js}'],
      synchronize: true,
      charset: 'utf8',
      timezone: '+08:00', // 设置时区为东八区（北京时间）
      extra: {
        connectionLimit: 10,
        multipleStatements: true,
        ssl: false,
      },
    }),
    DeviceModule,
    MessageModule,
    TcpModule,
    CacheModule,
  ],
  providers: [],
})
export class AppModule {}
